import { baseUrlApi, requestClient, type Result } from '#/api/request';

/** 获取列表 */
export const getLinkageData = (params?: object) => {
  return requestClient.get<Result>(baseUrlApi('/portal/admin/linkage_data'), {
    params,
  });
};

/** 添加 */
export const postLinkageData = (data?: object) => {
  return requestClient.post<Result>(
    baseUrlApi('/portal/admin/linkage_data'),
    data,
  );
};

/** 获取信息 */
export const getLinkageDataInfo = (data: { id: number }) => {
  return requestClient.get<Result>(
    baseUrlApi(`/portal/admin/linkage_data/${data.id}`),
  );
};

/** 编辑 */
export const putLinkageData = (id: number, data?: any) => {
  return requestClient.put<Result>(
    baseUrlApi(`/portal/admin/linkage_data/${id}`),
    data,
  );
};

/** 删除 */
export const deleteLinkageData = (id?: any) => {
  return requestClient.delete<Result>(
    baseUrlApi(`/portal/admin/linkage_data/${id}`),
  );
};

/** 设置状态 */
export const postLinkageDataStatus = (data?: { id: number }) => {
  return requestClient.post<Result>(
    baseUrlApi(`/portal/admin/linkage_data/status`),
    data,
  );
};

/** 后台菜单排序 */
export const postLinkageDataListOrder = (data?: { list_orders: object }) => {
  return requestClient.post<Result>(
    baseUrlApi('/portal/admin/linkage_data/list/order'),
    data,
  );
};
